<!DOCTYPE html>
<html lang="zh">
<head>
    <title><{:isset($webConf.bs_title)?$webConf.bs_title:'BS后台管理'}></title>
    <{include file="public/header"}>
    <{include file="public/data_tables_css"}>
    <!-- Ekko Lightbox -->
    <link rel="stylesheet" href="/static/adminlte/plugins/ekko-lightbox/ekko-lightbox.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<!-- Site wrapper -->
<div class="wrapper">
    <!-- Navbar -->
    <{include file="public/navbar"}>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <!--左侧菜单-->
    <{include file="public/sidebar"}>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>订单商品评价管理</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="<{:url('/admin/index/index')}>">首页</a></li>
                            <li class="breadcrumb-item"><a href="#">商品管理</a></li>
                            <li class="breadcrumb-item active">评价管理</li>
                        </ol>
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">


                <div class="card">
                    <div class="card-header">
                        <form action="<{:url()}>">
                            <div class="form-row ">

                                <div class="col-auto">
                                    <select name="status" class="form-control " >
                                        <option  value="">全部状态</option>
                                        <option <{if null !== $Request.param.status &&$Request.param.status=='1'}>selected<{/if}>  value="1">已通过</option>
                                        <option <{if null !== $Request.param.status &&$Request.param.status=='0'}>selected<{/if}> value="0">待审核</option>

                                    </select>
                                </div>

                                <div class="col-auto">

                                    <input name="keyword" type="text" class="form-control " placeholder="UID或者账号" value="">
                                </div>

                                <div class="col-auto">
                                    <button type="submit" class="btn btn-primary mb-2 "><i class="fas fa-search"></i></button>
                                    <a  href="<{:url('comment')}>"  class="btn btn-default mb-2 bs-left-30" title="重置"><i class="fas fa-history"></i></a>

                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">
                        <table id="my_table" class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>#</th>
                                <th>账号</th>
                                <th>商品</th>
                                <th>评价</th>
                                <th>状态</th>
                                <th>时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <{if !empty($data)}>
                            <{foreach $data as $item}>
                            <tr>
                                <td><{$item.id}></td>
                                <td>
                                    账号：<{$item.user.account}> <br>
                                    昵称：<{$item.user.nickname}>
                                </td>
                                <td>
                                    <{if !empty($item.goods)}>
                                    <img src="<{$item.goods.thumb}>" style="width: 50px" alt="">
                                    <span style="display: block"><{$item.goods.title}></span>
                                    <{else}>
                                    <span class="bs-red">商品已删除</span>
                                    <{/if}>
                                </td>
                                <td>
                                    星星数量：<{$item.star}> <br>
                                    评论内容： <{$item.content}>
                                    <{if !empty($item.imgs)}>
                                    <br>
                                    <{foreach $item.imgs as $img}>
                                    <a href="<{$img}>?text=12" data-toggle="lightbox" data-title=" <{$item.content}>" data-gallery="gallery">
                                        <img src="<{$img}>" alt="图片" width="50px" class="img-fluid mb-2">
                                    </a>
                                    <{/foreach}>
                                    <{/if}>
                                </td>

                                <td><{$item.statusDesc}></td>

                                <td>
                                   <{$item.add_time}>
                                </td>
                                <td>
                                    <{if $item.status=='0'}>
                                    <span class="btn  btn-danger btn-xs set-del" data-id="<{$item.id}>"  title="未审核的可以直接删除">删除</span>
                                    <span class="btn  btn-success btn-xs set-status" data-id="<{$item.id}>"   >通过</span>
                                   <{else}>
                                    不可操作
                                    <{/if}>

                                </td>

                            </tr>
                            <{/foreach}>
                            <{/if}>



                            </tbody>
                            <tfoot>


                            </tfoot>
                        </table>
                    </div>
                    <div class="card-footer">
                        <{$page?$page->render():''}>
                    </div>
                    <!-- /.card-body -->
                </div>
            </div>



        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <{include file="public/copyright"}>


</div>
<!-- ./wrapper -->

<{include file="public/footer"}>
<!-- DataTables  & Plugins -->
<{include file="public/data_tables"}>
<!-- Ekko Lightbox -->
<script src="/static/adminlte/plugins/ekko-lightbox/ekko-lightbox.min.js"></script>
<script>

    $(function () {
        $(".set-del").on('click',function () {
            var id = $(this).data('id');
            layer.confirm('确定要删除吗',{title:'0',btn:['确定','再想想']},function (index) {
                sendData("<{:url('comment_action')}>",{id:id,ac:'del'},function (res) {
                    if (res.code==0){
                        location.reload()
                        layer.close(index)
                    }
                })

            })
        });
        $(".set-status").on('click',function () {
            var id = $(this).data('id');
            layer.confirm('确定要通过吗',{title:0,btn:['确定','再想想']},function (index) {
                sendData("<{:url('comment_action')}>",{id:id,ac:'status'},function (res) {
                    if (res.code==0){
                        location.reload()
                        layer.close(index)
                    }
                })

            })
        });


        $("#my_table").DataTable({
            "ordering": false,//禁用排序
            "responsive": true,
            "lengthChange": false,
            "autoWidth": false,
           //"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"],
           // "pageLength": 10,         //初始化显示几条数据
            //serverSide: true, // use local process instead of server
           // bFilter: true, // show top right search input box.
            bPaginate: false,//是否开启分页
            //iDisplayLength: 10, //默认显示的记录数
            bInfo: false,//是否显示页脚信息，DataTables插件左下角显示记录数
        }).buttons().container().appendTo('#my_table_wrapper .col-md-6:eq(0)');

    });
</script>
<script>
    $(function () {
        $(document).on('click', '[data-toggle="lightbox"]', function(event) {
            event.preventDefault();
            $(this).ekkoLightbox({
                alwaysShowClose: true
            });
        });

        $('.filter-container').filterizr({gutterPixels: 3});
        $('.btn[data-filter]').on('click', function() {
            $('.btn[data-filter]').removeClass('active');
            $(this).addClass('active');
        });
    })
</script>
</body>
</html>
